package com.yunmang.utils;

import com.yunmang.entity.EndModel;

import java.util.Comparator;
/**
 * 想要通过collections.sort排序，必须让实现comprator这个接口，自己在compare中定义比较大小规则
 * compareTo这个方法是字符串的方法
 * @author Administrator
 *
 */
public class PinyinComparator implements Comparator<EndModel> {

	@Override
	public int compare(EndModel m1, EndModel m2) {
		if(m1.firstLetter.equals("@")||m2.firstLetter.equals("#")){
			return -1;
		}else if(m1.firstLetter.equals("#")||m2.firstLetter.equals("@")){
			return 1;
		}else{
			return m1.firstLetter.compareTo(m2.firstLetter);
		}
	}

}
